home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / TrayCreateItem.au3 < prev    next >
Text File  |  2007-09-08  |  2KB  |  77 lines

  1. ; ****************
  2. ; * First sample *
  3. ; ****************
  4.  
  5. #Include <Constants.au3>
  6. #NoTrayIcon
  7.  
  8. Opt("TrayMenuMode",1)    ; Default tray menu items (Script Paused/Exit) will not be shown.
  9.  
  10. $prefsitem    = TrayCreateItem("Preferences")
  11. TrayCreateItem("")
  12. $aboutitem    = TrayCreateItem("About")
  13. TrayCreateItem("")
  14. $exititem    = TrayCreateItem("Exit")
  15.  
  16. TraySetState()
  17.  
  18. While 1
  19.     $msg = TrayGetMsg()
  20.     Select
  21.         Case $msg = 0
  22.             ContinueLoop
  23.         Case $msg = $prefsitem
  24.             Msgbox(64, "Preferences:", "OS:" & @OSVersion)
  25.         Case $msg = $aboutitem
  26.             Msgbox(64, "About:", "AutoIt3-Tray-sample.")
  27.         Case $msg = $exititem
  28.             ExitLoop
  29.     EndSelect
  30. WEnd
  31.  
  32. Exit
  33.  
  34.  
  35. ; *****************
  36. ; * Second sample *
  37. ; *****************
  38.  
  39. #Include <Constants.au3>
  40. #NoTrayIcon
  41.  
  42. Opt("TrayMenuMode",1)    ; Default tray menu items (Script Paused/Exit) will not be shown.
  43.  
  44. ; Let's create 2 radio menuitem groups
  45. $radio1    = TrayCreateItem("Radio1", -1, -1, 1)
  46. TrayItemSetState(-1, $TRAY_CHECKED)
  47. $radio2    = TrayCreateItem("Radio2", -1, -1, 1)
  48. $radio3    = TrayCreateItem("Radio3", -1, -1, 1)
  49.  
  50. TrayCreateItem("")    ; Radio menuitem groups can be separated by a separator line or another norma menuitem
  51.  
  52. $radio4    = TrayCreateItem("Radio4", -1, -1, 1)
  53. $radio5    = TrayCreateItem("Radio5", -1, -1, 1)
  54. TrayItemSetState(-1, $TRAY_CHECKED)
  55. $radio6    = TrayCreateItem("Radio6", -1, -1, 1)
  56.  
  57. TrayCreateItem("")
  58.  
  59. $aboutitem    = TrayCreateItem("About")
  60. TrayCreateItem("")
  61. $exititem    = TrayCreateItem("Exit")
  62.  
  63. TraySetState()
  64.  
  65. While 1
  66.     $msg = TrayGetMsg()
  67.     Select
  68.         Case $msg = 0
  69.             ContinueLoop
  70.         Case $msg = $aboutitem
  71.             Msgbox(64, "About:", "AutoIt3-Tray-sample with radio menuitem groups.")
  72.         Case $msg = $exititem
  73.             ExitLoop
  74.     EndSelect
  75. WEnd
  76.  
  77. Exit